package objects;

import java.util.ArrayList;
import java.util.List;

public class Containable {

	protected List<Player> players;
	protected List<Character> characters;
	
	public Containable(List<Player> players)
	{
		this.players = players;
		this.characters = new ArrayList<Character>();
	}
	
	public void participantEnter(Object participant)
	{
		if (participant instanceof Player)
		{
			if (!this.players.contains((Player)participant))
			{
				players.add((Player)participant);
			}
		}
		else
		{
			if (!this.characters.contains((Character)participant))
			{
				characters.add((Character)participant);
			}
		}
	}
	
	public void participantExit(Object participant)
	{
		if (participant instanceof Player)
		{
			players.remove((Player)participant);
		}
		else
		{
			characters.remove((Character)participant);
		}
	}
	
	public boolean isCharacterIn(Character character)
	{
		return characters.contains(character);
	}
	
	public List<Player> getPlayers() {
		return players;
	}

	public void setPlayers(List<Player> players) {
		this.players = players;
	}

	public List<Character> getCharacters() {
		return characters;
	}

	public void setCharacters(List<Character> characters) {
		this.characters = characters;
	}
	
}
